From aa15d5287d898b624a30a70d14e495899f7d251e Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Wed, 30 Jul 2014 10:56:25 -0700 Subject: [PATCH] Add blanket support for mediawiki ui via globals This provides better mobile experiences on various pages and a more consistent UI across both mobile and desktop. It does this in two ways. 1) Forces HTMLForms to not use table based layouts so as not to interfere with responsive nature of mediawiki ui elements 2) Applies MediaWiki.UI classes to most pages If a page is created via Xml or Html classes it will use mediawiki ui Where possible I've added classes unconditionally, but for cases of buttons this is behind the $wgUseMediaWikiUIEverywhere global since button styling is enabled on pages by default and for checkboxes since it is changes HTML markup. 3) Adds all MediaWiki.UI styles to pages which can use it When enabled: * Apply these styles to all pages which use HTMLForms * Apply to EditPage * Apply to anything that uses certain elements outputted by the Xml or HTML helper classes * Apply to History page * Apply to protection page * Apply to move page * Apply to deletion page Currently kept behind a global to allow us time to finetune existing elements. After further testing we will look to kill the globals and make mediawiki.ui the default See: I430c0fbb79d2a33bb828b2427bda0ee01115d73f Change-Id: I47db5eab4569514d039261d11b6dedb0eeae17b5 --- includes/DefaultSettings.php | 17 ++++++++ includes/EditPage.php | 51 +++++++++++++++++++--- includes/Html.php | 35 ++++++++++++++- includes/Xml.php | 42 ++++++++++++++---- includes/actions/DeleteAction.php | 9 +++- includes/actions/EditAction.php | 8 ++++ includes/actions/HistoryAction.php | 17 +++++++- includes/actions/ProtectAction.php | 8 ++++ includes/htmlform/HTMLCheckField.php | 4 +- includes/htmlform/HTMLCheckMatrix.php | 14 +++++- includes/htmlform/HTMLForm.php | 25 +++++++++-- includes/htmlform/HTMLMultiSelectField.php | 1 + includes/htmlform/HTMLTextAreaField.php | 4 +- includes/htmlform/HTMLTextField.php | 10 ++--- includes/specialpage/SpecialPage.php | 6 +++ tests/phpunit/includes/HtmlTest.php | 2 +- tests/phpunit/includes/XmlTest.php | 12 ++--- 17 files changed, 221 insertions(+), 44 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 304a75fff2..cf00701e80 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2851,6 +2851,23 @@ $wgHtml5 = true; */ $wgHtml5Version = null; +/** + * Temporary variable that allows HTMLForms to be rendered as tables. + * Table based layouts cause various issues when designing for mobile. + * This global allows skins or extensions a means to force non-table based rendering. + * Setting to false forces form components to always render as div elements. + * @since 1.24 + */ +$wgHTMLFormAllowTableFormat = true; + +/** + * Temporary variable that applies MediaWiki UI wherever it can be supported. + * Temporary variable that should be removed when mediawiki ui is more + * stable and change has been communicated. + * @since 1.24 + */ +$wgUseMediaWikiUIEverywhere = false; + /** * Enabled RDFa attributes for use in wikitext. * NOTE: Interaction with HTML5 is somewhat underspecified. diff --git a/includes/EditPage.php b/includes/EditPage.php index f97e3f86c3..145eae2b60 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3183,7 +3183,7 @@ HTML } protected function showStandardInputs( &$tabindex = 2 ) { - global $wgOut; + global $wgOut, $wgUseMediaWikiUIEverywhere; $wgOut->addHTML( "
\n" ); if ( $this->section != 'new' ) { @@ -3211,8 +3211,14 @@ HTML $message = wfMessage( 'edithelppage' )->inContentLanguage()->text(); $edithelpurl = Skin::makeInternalOrExternalUrl( $message ); - $edithelp = '' . - wfMessage( 'edithelp' )->escaped() . ' ' . + $attrs = array( + 'target' => 'helpwindow', + 'href' => $edithelpurl, + ); + if ( $wgUseMediaWikiUIEverywhere ) { + $attrs['class'] = 'mw-ui-button mw-ui-quiet'; + } + $edithelp = Html::element( 'a', $attrs, wfMessage( 'edithelp' )->text() ) . wfMessage( 'newwindow' )->parse(); $wgOut->addHTML( " {$cancel}\n" ); @@ -3254,15 +3260,20 @@ HTML * @return string */ public function getCancelLink() { + global $wgUseMediaWikiUIEverywhere; $cancelParams = array(); if ( !$this->isConflict && $this->oldid > 0 ) { $cancelParams['oldid'] = $this->oldid; } + $attrs = array( 'id' => 'mw-editform-cancel' ); + if ( $wgUseMediaWikiUIEverywhere ) { + $attrs['class'] = 'mw-ui-button mw-ui-quiet'; + } return Linker::linkKnown( $this->getContextTitle(), wfMessage( 'cancel' )->parse(), - array( 'id' => 'mw-editform-cancel' ), + $attrs, $cancelParams ); } @@ -3690,7 +3701,7 @@ HTML * @return array */ public function getCheckboxes( &$tabindex, $checked ) { - global $wgUser; + global $wgUser, $wgUseMediaWikiUIEverywhere; $checkboxes = array(); @@ -3704,11 +3715,19 @@ HTML 'accesskey' => wfMessage( 'accesskey-minoredit' )->text(), 'id' => 'wpMinoredit', ); - $checkboxes['minor'] = + $minorEditHtml = Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) . " "; + + if ( $wgUseMediaWikiUIEverywhere ) { + $checkboxes['minor'] = Html::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) . + $minorEditHtml . + Html::closeElement( 'div' ); + } else { + $checkboxes['minor'] = $minorEditHtml; + } } } @@ -3720,11 +3739,18 @@ HTML 'accesskey' => wfMessage( 'accesskey-watch' )->text(), 'id' => 'wpWatchthis', ); - $checkboxes['watch'] = + $watchThisHtml = Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) . " "; + if ( $wgUseMediaWikiUIEverywhere ) { + $checkboxes['watch'] = Html::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) . + $watchThisHtml . + Html::closeElement( 'div' ); + } else { + $checkboxes['watch'] = $watchThisHtml; + } } wfRunHooks( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) ); return $checkboxes; @@ -3739,6 +3765,8 @@ HTML * @return array */ public function getEditButtons( &$tabindex ) { + global $wgUseMediaWikiUIEverywhere; + $buttons = array(); $attribs = array( @@ -3748,6 +3776,9 @@ HTML 'tabindex' => ++$tabindex, 'value' => wfMessage( 'savearticle' )->text(), ) + Linker::tooltipAndAccesskeyAttribs( 'save' ); + if ( $wgUseMediaWikiUIEverywhere ) { + $attribs['class'] = 'mw-ui-button mw-ui-constructive'; + } $buttons['save'] = Xml::element( 'input', $attribs, '' ); ++$tabindex; // use the same for preview and live preview @@ -3758,6 +3789,9 @@ HTML 'tabindex' => $tabindex, 'value' => wfMessage( 'showpreview' )->text(), ) + Linker::tooltipAndAccesskeyAttribs( 'preview' ); + if ( $wgUseMediaWikiUIEverywhere ) { + $attribs['class'] = 'mw-ui-button mw-ui-progressive'; + } $buttons['preview'] = Xml::element( 'input', $attribs, '' ); $buttons['live'] = ''; @@ -3768,6 +3802,9 @@ HTML 'tabindex' => ++$tabindex, 'value' => wfMessage( 'showdiff' )->text(), ) + Linker::tooltipAndAccesskeyAttribs( 'diff' ); + if ( $wgUseMediaWikiUIEverywhere ) { + $attribs['class'] = 'mw-ui-button mw-ui-progressive'; + } $buttons['diff'] = Xml::element( 'input', $attribs, '' ); wfRunHooks( 'EditPageBeforeEditButtons', array( &$this, &$buttons, &$tabindex ) ); diff --git a/includes/Html.php b/includes/Html.php index 419250795d..9e7f5c4db4 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -101,6 +101,35 @@ class Html { 'itemscope', ); + /** + * Modifies a set of attributes meant for text input elements + * and apply a set of default attributes. + * Removes size attribute when $wgUseMediaWikiUIEverywhere enabled. + * @param array $attrs An attribute array. + * @return array $attrs A modified attribute array + */ + public static function getTextInputAttributes( $attrs ) { + global $wgUseMediaWikiUIEverywhere; + if ( !$attrs ) { + $attrs = array(); + } + if ( isset( $attrs['class'] ) ) { + if ( is_array( $attrs['class'] ) ) { + $attrs['class'][] = 'mw-ui-input'; + } else { + $attrs['class'] .= ' mw-ui-input'; + } + } else { + $attrs['class'] = 'mw-ui-input'; + } + if ( $wgUseMediaWikiUIEverywhere ) { + // Note that size can effect the desired width rendering of mw-ui-input elements + // so it is removed. Left intact when mediawiki ui not enabled. + unset( $attrs['size'] ); + } + return $attrs; + } + /** * Returns an HTML element in a string. The major advantage here over * manually typing out the HTML is that it will escape all attribute @@ -632,7 +661,9 @@ class Html { $attribs['type'] = $type; $attribs['value'] = $value; $attribs['name'] = $name; - + if ( in_array( $type, array( 'text', 'search', 'email', 'password', 'number' ) ) ) { + $attribs = Html::getTextInputAttributes( $attribs ); + } return self::element( 'input', $attribs ); } @@ -731,7 +762,7 @@ class Html { } else { $spacedValue = $value; } - return self::element( 'textarea', $attribs, $spacedValue ); + return self::element( 'textarea', Html::getTextInputAttributes( $attribs ), $spacedValue ); } /** diff --git a/includes/Xml.php b/includes/Xml.php index 7761ecc0a6..6df625898c 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -317,7 +317,8 @@ class Xml { $attributes['value'] = $value; } - return self::element( 'input', $attributes + $attribs ); + return self::element( 'input', + Html::getTextInputAttributes( $attributes + $attribs ) ); } /** @@ -453,9 +454,16 @@ class Xml { * @return string HTML */ public static function checkLabel( $label, $name, $id, $checked = false, $attribs = array() ) { - return self::check( $name, $checked, array( 'id' => $id ) + $attribs ) . + global $wgUseMediaWikiUIEverywhere; + $chkLabel = self::check( $name, $checked, array( 'id' => $id ) + $attribs ) . ' ' . self::label( $label, $id, $attribs ); + + if ( $wgUseMediaWikiUIEverywhere ) { + $chkLabel = self::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) . + $chkLabel . self::closeElement( 'div' ); + } + return $chkLabel; } /** @@ -480,12 +488,26 @@ class Xml { /** * Convenience function to build an HTML submit button + * When $wgUseMediaWikiUIEverywhere is true it will default to a constructive button * @param string $value Label text for the button * @param array $attribs Optional custom attributes * @return string HTML */ public static function submitButton( $value, $attribs = array() ) { - return Html::element( 'input', array( 'type' => 'submit', 'value' => $value ) + $attribs ); + global $wgUseMediaWikiUIEverywhere; + $baseAttrs = array( + 'type' => 'submit', + 'value' => $value, + ); + // Done conditionally for time being as it is possible + // some submit forms + // might need to be mw-ui-destructive (e.g. delete a page) + if ( $wgUseMediaWikiUIEverywhere ) { + $baseAttrs['class'] = 'mw-ui-button mw-ui-constructive'; + } + // Any custom attributes will take precendence of anything in baseAttrs e.g. override the class + $attribs = $attribs + $baseAttrs; + return Html::element( 'input', $attribs ); } /** @@ -617,12 +639,14 @@ class Xml { */ public static function textarea( $name, $content, $cols = 40, $rows = 5, $attribs = array() ) { return self::element( 'textarea', - array( - 'name' => $name, - 'id' => $name, - 'cols' => $cols, - 'rows' => $rows - ) + $attribs, + Html::getTextInputAttributes( + array( + 'name' => $name, + 'id' => $name, + 'cols' => $cols, + 'rows' => $rows + ) + $attribs + ), $content, false ); } diff --git a/includes/actions/DeleteAction.php b/includes/actions/DeleteAction.php index 069d570063..9dc10494b2 100644 --- a/includes/actions/DeleteAction.php +++ b/includes/actions/DeleteAction.php @@ -41,7 +41,14 @@ class DeleteAction extends FormlessAction { } public function show() { - + global $wgUseMediaWikiUIEverywhere; + if ( $wgUseMediaWikiUIEverywhere ) { + $out = $this->getOutput(); + $out->addModuleStyles( array( + 'mediawiki.ui.input', + 'mediawiki.ui.checkbox', + ) ); + } $this->page->delete(); } } diff --git a/includes/actions/EditAction.php b/includes/actions/EditAction.php index 5a1e2c1fd9..aaf45269c2 100644 --- a/includes/actions/EditAction.php +++ b/includes/actions/EditAction.php @@ -41,6 +41,14 @@ class EditAction extends FormlessAction { } public function show() { + global $wgUseMediaWikiUIEverywhere; + if ( $wgUseMediaWikiUIEverywhere ) { + $out = $this->getOutput(); + $out->addModuleStyles( array( + 'mediawiki.ui.input', + 'mediawiki.ui.checkbox', + ) ); + } $page = $this->page; $user = $this->getUser(); diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 7ca8f3a66a..66ea2453b8 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -105,9 +105,10 @@ class HistoryAction extends FormlessAction { wfProfileIn( __METHOD__ ); $this->preCacheMessages(); + $config = $this->context->getConfig(); # Fill in the file cache if not set already - $useFileCache = $this->context->getConfig()->get( 'UseFileCache' ); + $useFileCache = $config->get( 'UseFileCache' ); if ( $useFileCache && HTMLFileCache::useFileCache( $this->getContext() ) ) { $cache = HTMLFileCache::newFromTitle( $this->getTitle(), 'history' ); if ( !$cache->isCacheGood( /* Assume up to date */ ) ) { @@ -118,6 +119,13 @@ class HistoryAction extends FormlessAction { // Setup page variables. $out->setFeedAppendQuery( 'action=history' ); $out->addModules( 'mediawiki.action.history' ); + if ( $config->get( 'UseMediaWikiUIEverywhere' ) ) { + $out = $this->getOutput(); + $out->addModuleStyles( array( + 'mediawiki.ui.input', + 'mediawiki.ui.checkbox', + ) ); + } // Handle atom/RSS feeds. $feedType = $request->getVal( 'feed' ); @@ -464,6 +472,7 @@ class HistoryPager extends ReverseChronologicalPager { * @return string HTML output */ function getStartBody() { + global $wgUseMediaWikiUIEverywhere; $this->lastRow = false; $this->counter = 1; $this->oldIdChecked = 0; @@ -476,8 +485,12 @@ class HistoryPager extends ReverseChronologicalPager { // Button container stored in $this->buttons for re-use in getEndBody() $this->buttons = '
'; + $className = 'historysubmit mw-history-compareselectedversions-button'; + if ( $wgUseMediaWikiUIEverywhere ) { + $className .= ' mw-ui-button mw-ui-constructive'; + } $this->buttons .= $this->submitButton( $this->msg( 'compareselectedversions' )->text(), - array( 'class' => 'historysubmit mw-history-compareselectedversions-button' ) + array( 'class' => $className ) + Linker::tooltipAndAccesskeyAttribs( 'compareselectedversions' ) ) . "\n"; diff --git a/includes/actions/ProtectAction.php b/includes/actions/ProtectAction.php index 2c2b4709f5..443660b4f6 100644 --- a/includes/actions/ProtectAction.php +++ b/includes/actions/ProtectAction.php @@ -41,6 +41,14 @@ class ProtectAction extends FormlessAction { } public function show() { + global $wgUseMediaWikiUIEverywhere; + if ( $wgUseMediaWikiUIEverywhere ) { + $out = $this->getOutput(); + $out->addModuleStyles( array( + 'mediawiki.ui.input', + 'mediawiki.ui.checkbox', + ) ); + } $this->page->protect(); } diff --git a/includes/htmlform/HTMLCheckField.php b/includes/htmlform/HTMLCheckField.php index a0dd37054d..4eb7e6ef96 100644 --- a/includes/htmlform/HTMLCheckField.php +++ b/includes/htmlform/HTMLCheckField.php @@ -26,9 +26,7 @@ class HTMLCheckField extends HTMLFormField { ), Xml::check( $this->mName, $value, $attr ) . $this->mLabel ); } else { - return Xml::check( $this->mName, $value, $attr ) - . ' ' - . Html::rawElement( 'label', array( 'for' => $this->mID ), $this->mLabel ); + return Xml::checkLabel( $this->mLabel, $this->mName, $this->mID, $value, $attr ); } } diff --git a/includes/htmlform/HTMLCheckMatrix.php b/includes/htmlform/HTMLCheckMatrix.php index 606523b6ad..825552696f 100644 --- a/includes/htmlform/HTMLCheckMatrix.php +++ b/includes/htmlform/HTMLCheckMatrix.php @@ -80,6 +80,8 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable { * @return string */ function getInputHTML( $value ) { + global $wgUseMediaWikiUIEverywhere; + $html = ''; $tableContents = ''; $rows = $this->mParams['rows']; @@ -113,8 +115,9 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable { foreach ( $columns as $columnTag ) { $thisTag = "$columnTag-$rowTag"; // Construct the checkbox + $thisId = "{$this->mID}-$thisTag"; $thisAttribs = array( - 'id' => "{$this->mID}-$thisTag", + 'id' => $thisId, 'value' => $thisTag, ); $checked = in_array( $thisTag, (array)$value, true ); @@ -125,10 +128,17 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable { $checked = true; $thisAttribs['disabled'] = 1; } + $chkBox = Xml::check( "{$this->mName}[]", $checked, $attribs + $thisAttribs ); + if ( $wgUseMediaWikiUIEverywhere ) { + $chkBox = Html::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) . + $chkBox . + Html::element( 'label', array( 'for' => $thisId ) ) . + Html::closeElement( 'div' ); + } $rowContents .= Html::rawElement( 'td', array(), - Xml::check( "{$this->mName}[]", $checked, $attribs + $thisAttribs ) + $chkBox ); } $tableContents .= Html::rawElement( 'tr', array(), "\n$rowContents\n" ); diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index 6cf8d0a7eb..885bcd7503 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -299,7 +299,12 @@ class HTMLForm extends ContextSource { * @return string */ public function getDisplayFormat() { - return $this->displayFormat; + global $wgHTMLFormAllowTableFormat; + $format = $this->displayFormat; + if ( !$wgHTMLFormAllowTableFormat && $format === 'table' ) { + $format = 'div'; + } + return $format; } /** @@ -868,6 +873,7 @@ class HTMLForm extends ContextSource { * @return string HTML. */ function getButtons() { + global $wgUseMediaWikiUIEverywhere; $buttons = ''; if ( $this->mShowSubmit ) { @@ -887,15 +893,17 @@ class HTMLForm extends ContextSource { $attribs['class'] = array( 'mw-htmlform-submit' ); + if ( $this->isVForm() || $wgUseMediaWikiUIEverywhere ) { + array_push( $attribs['class'], 'mw-ui-button', 'mw-ui-constructive' ); + } + if ( $this->isVForm() ) { // mw-ui-block is necessary because the buttons aren't necessarily in an // immediate child div of the vform. // @todo Let client specify if the primary submit button is progressive or destructive array_push( $attribs['class'], - 'mw-ui-button', 'mw-ui-big', - 'mw-ui-constructive', 'mw-ui-block' ); } @@ -928,6 +936,14 @@ class HTMLForm extends ContextSource { $attrs['id'] = $button['id']; } + if ( $wgUseMediaWikiUIEverywhere ) { + if ( isset( $attrs['class' ] ) ) { + $attrs['class'] .= ' mw-ui-button'; + } else { + $attrs['class'] = 'mw-ui-button'; + } + } + $buttons .= Html::element( 'input', $attrs ) . "\n"; } @@ -1245,6 +1261,9 @@ class HTMLForm extends ContextSource { // Close enough to a div. $getFieldHtmlMethod = 'getDiv'; break; + case 'div': + $getFieldHtmlMethod = 'getDiv'; + break; default: $getFieldHtmlMethod = 'get' . ucfirst( $displayFormat ); } diff --git a/includes/htmlform/HTMLMultiSelectField.php b/includes/htmlform/HTMLMultiSelectField.php index 576f5cd66a..1b71ab9513 100644 --- a/includes/htmlform/HTMLMultiSelectField.php +++ b/includes/htmlform/HTMLMultiSelectField.php @@ -47,6 +47,7 @@ class HTMLMultiSelectField extends HTMLFormField implements HTMLNestedFilterable } else { $thisAttribs = array( 'id' => "{$this->mID}-$info", 'value' => $info ); + // @todo: Make this use checkLabel for consistency purposes $checkbox = Xml::check( $this->mName . '[]', in_array( $info, $value, true ), diff --git a/includes/htmlform/HTMLTextAreaField.php b/includes/htmlform/HTMLTextAreaField.php index 4fd198976b..21173d2a63 100644 --- a/includes/htmlform/HTMLTextAreaField.php +++ b/includes/htmlform/HTMLTextAreaField.php @@ -15,7 +15,6 @@ class HTMLTextAreaField extends HTMLFormField { function getInputHTML( $value ) { $attribs = array( 'id' => $this->mID, - 'name' => $this->mName, 'cols' => $this->getCols(), 'rows' => $this->getRows(), ) + $this->getTooltipAndAccessKey(); @@ -34,7 +33,6 @@ class HTMLTextAreaField extends HTMLFormField { ); $attribs += $this->getAttributes( $allowedParams ); - - return Html::element( 'textarea', $attribs, $value ); + return Html::textarea( $this->mName, $value, $attribs ); } } diff --git a/includes/htmlform/HTMLTextField.php b/includes/htmlform/HTMLTextField.php index e584d886c4..10bc67f0be 100644 --- a/includes/htmlform/HTMLTextField.php +++ b/includes/htmlform/HTMLTextField.php @@ -41,13 +41,14 @@ class HTMLTextField extends HTMLFormField { # Implement tiny differences between some field variants # here, rather than creating a new class for each one which # is essentially just a clone of this one. + $type = 'text'; if ( isset( $this->mParams['type'] ) ) { switch ( $this->mParams['type'] ) { case 'int': - $attribs['type'] = 'number'; + $type = 'number'; break; case 'float': - $attribs['type'] = 'number'; + $type = 'number'; $attribs['step'] = 'any'; break; # Pass through @@ -55,11 +56,10 @@ class HTMLTextField extends HTMLFormField { case 'password': case 'file': case 'url': - $attribs['type'] = $this->mParams['type']; + $type = $this->mParams['type']; break; } } - - return Html::element( 'input', $attribs ); + return Html::input( $this->mName, $value, $type, $attribs ); } } diff --git a/includes/specialpage/SpecialPage.php b/includes/specialpage/SpecialPage.php index 4edd87adba..8fc28f88ce 100644 --- a/includes/specialpage/SpecialPage.php +++ b/includes/specialpage/SpecialPage.php @@ -333,6 +333,12 @@ class SpecialPage { $out->setArticleRelated( false ); $out->setRobotPolicy( $this->getRobotPolicy() ); $out->setPageTitle( $this->getDescription() ); + if ( $this->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) { + $out->addModuleStyles( array( + 'mediawiki.ui.input', + 'mediawiki.ui.checkbox', + ) ); + } } /** diff --git a/tests/phpunit/includes/HtmlTest.php b/tests/phpunit/includes/HtmlTest.php index d4d955131c..a8829cd848 100644 --- a/tests/phpunit/includes/HtmlTest.php +++ b/tests/phpunit/includes/HtmlTest.php @@ -715,7 +715,7 @@ class HtmlTest extends MediaWikiTestCase { 'Input wrapper with type and value.' ); $this->assertEquals( - '', + '', Html::input( 'testname' ), 'Input wrapper with all default values.' ); diff --git a/tests/phpunit/includes/XmlTest.php b/tests/phpunit/includes/XmlTest.php index 382e3d89b5..e655881975 100644 --- a/tests/phpunit/includes/XmlTest.php +++ b/tests/phpunit/includes/XmlTest.php @@ -81,7 +81,7 @@ class XmlTest extends MediaWikiTestCase { */ public function testElementInputCanHaveAValueOfZero() { $this->assertEquals( - '', + '', Xml::input( 'name', false, 0 ), 'Input with a value of 0 (bug 23797)' ); @@ -152,7 +152,7 @@ class XmlTest extends MediaWikiTestCase { $this->assertEquals( ' ' . - ' ' . + ' ' . ' ' . ' ' . + ' ' . ' ' . ' ' . + ' ' . ' ' . '', + '', Xml::textarea( 'name', '' ), 'textarea() with not content' ); @@ -244,7 +244,7 @@ class XmlTest extends MediaWikiTestCase { */ public function testTextareaAttribs() { $this->assertEquals( - '', + '', Xml::textarea( 'name', '', 20, 10 ), 'textarea() with custom attribs' ); -- 2.20.1